package com.apes.fn.business.insurance.modle;

import com.alibaba.fastjson.annotation.JSONField;
import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.framework.util.DateUtil;
import com.apes.scm.masterdata.frame.model.Dept;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * @ClassName InsuranceSaleTask
 * @Author wsj
 * @Date 2021/5/21 16:42
 * @description 车险销售任务报表
 */
@Entity
@Table(name = InsuranceSaleTask.CONST_TABLE_NAME)
@Getter
@Setter
@SelectBeforeUpdate
@DynamicUpdate
@DynamicInsert
@EntityListeners(DefaultPersistListener.class)
public class InsuranceSaleTask extends BaseModel {
    public final static String CONST_TABLE_NAME = "insurance_sale_task";

    @Id
    @Column(name = "id", nullable = false, length = 8)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "车险销售任务报表")
    @Comment("序列号")
    private String id;

    @JSONField(format = DateUtil.SHOW_DATE_FORMAT)
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "statistic_Date")
    @Comment("统计日期")
    private Date statisticDate;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "dept_id",referencedColumnName = "id")
    @Comment("门店")
    private Dept dept;

    @Column(name = "dept_Name",length = 64)
    @Comment("门店名称")
    private String deptName;


    @Comment("商业险销售金额")
    @Column(name = "commercial_Insurance_Amount", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private Double commercialInsuranceAmount = 0.0;

    @Comment("交强险销售金额")
    @Column(name = "compulsory_Insurance_Amount", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private Double compulsoryInsuranceAmount = 0.0;

    @Comment("当天销售金额")
    @Column(name = "today_Sale_Amount", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private Double todaySaleAmount = 0.0;

    @Comment("销售总金额")
    @Column(name = "total_Sale_Amount", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private Double totalSaleAmount = 0.0;

    @Comment("商业险总金额")
    @Column(name = "total_Commercial_Insurance", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private Double totalCommercialInsurance = 0.0;

    @Comment("商业险销售任务")
    @Column(name = "commercial_Insurance_Task", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private Double commercialInsuranceTask = 0.0;

    @Comment("销售任务")
    @Column(name = "sale_Amount_Task", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private Double saleAmountTask = 0.0;

    @Comment("任务进度")
    @Column(name = "task_Progress", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private Double taskProgress;

    @JSONField(format = DateUtil.SHOW_DATE_FORMAT)
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "start_Date")
    @Comment("任务开始日期")
    private Date startDate;


    @JSONField(format = DateUtil.SHOW_DATE_FORMAT)
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "end_Date")
    @Comment("任务结束日期")
    private Date endDate;

    @Column(name = "task_Rules_Number",length = 64)
    @Comment("任务规则单号")
    private String taskRulesNumber;

}
